﻿@model Prosiak.Areas.Books.Book

@{
    ViewBag.Title = "Edit";
}
@using Prosiak.Areas.Books.Helpers

<h2>Edit</h2>


@using (Html.BeginForm())
{
    @Html.AntiForgeryToken()
    
    <div class="form-horizontal">
        <h4>Book</h4>
        <img src="@Url.Content(Html.ThumbnailPath(Model.Isbn))" />
        <hr />
        @Html.ValidationSummary(true)
        @Html.HiddenFor(model => model.ID)

        <div class="form-group">
            @Html.LabelFor(model => model.Title, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Title)
                @Html.ValidationMessageFor(model => model.Title)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Author, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Author)
                @Html.ValidationMessageFor(model => model.Author)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Isbn, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Isbn)
                @Html.ValidationMessageFor(model => model.Isbn)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Category, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Category)
                @Html.ValidationMessageFor(model => model.Category)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Owner, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Owner)
                @Html.ValidationMessageFor(model => model.Owner)
            </div>
        </div>

        <div class="form-group">
            @Html.LabelFor(model => model.Status, new { @class = "control-label col-md-2" })
            <div class="col-md-10">
                @Html.EditorFor(model => model.Status)
                @Html.ValidationMessageFor(model => model.Status)
            </div>
        </div>

        <div class="form-group">
            <div class="col-md-offset-2 col-md-10">
                <input type="submit" value="Save" class="btn btn-default" />
            </div>
        </div>
    </div>
}

@using (Html.BeginForm("FetchThumbnail", "Books", new { bookId = Model.ID }, FormMethod.Post))
{
    <input type="submit" value="Fetch Thumbnail" class="btn btn-default btn-sm" data-prosiak-fetch="@Model.Isbn" />
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>